"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = void 0;

var initializeEventEmitter = function initializeEventEmitter(player, eventEmitter, props) {
  var singleton = props.singleton;

  var eventEmitterPlayImpl = function eventEmitterPlayImpl(target) {
    if (target === player) return;
    if (!singleton) return;

    if (player && player.pause) {
      // FIXME web端点击播放的时候，这句代码报错 「pause null」,不影响业务，暂时屏蔽报错
      try {
        player.pause();
      } catch (error) {}
    }
  };

  player.on('play', function () {
    eventEmitter.emit('play', player);
  });
  eventEmitter.on('play', eventEmitterPlayImpl);
};

var _default = initializeEventEmitter;
exports.default = _default;